package cn.yhjz.common;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 表格分页数据对象
 *
 * @author yhjz
 */
@Data
public class Pager implements Serializable {

    //当前页码
    private Long currentPage;

    //每页数据条数
    private Long pageSize;
    //总记录数
    private Long totalCount;
    //总页数
    private Long totalPageCount;

    //列表
    private List<?> rows;

    public Pager() {
        this.currentPage = 1L;
        this.pageSize = 10L;
    }

    public Pager(Long currentPage, Long pageSize, Long totalCount) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.totalPageCount = Double.valueOf(Math.ceil((this.totalCount + 0.0d) / this.pageSize)).longValue();
    }

}
